<?php
class myUser extends dmFrontUser
{
    public function getCartCookieSession($type = 'cart_session_id')
    {

        if(is_null(sfContext::getInstance()->getRequest()->getCookie($type))) {
            $session_id = session_id();
            sfContext::getInstance()->getResponse()->setCookie($type, $session_id,(time()+60*60*24*2), '/');
        }else {
            $session_id = sfContext::getInstance()->getRequest()->getCookie($type);
        }
        return $session_id;
    }
    public function getShoppingCart()
    {
        if (!$this->hasAttribute('shopping_cart')) {
            $this->setAttribute('shopping_cart', new sfShoppingCart(sfConfig::get('app_cart_tax')));
        }

        return $this->getAttribute('shopping_cart');
    }

}